#pragma once
//系统库文件
#include "string.h"
#include "inttypes.h"
//硬件底层相关头文件
#include "driver/i2c.h"
#include "driver/uart.h"
#include "driver/gpio.h"
#include "esp_system.h"
#include "esp_log.h"
#include "nvs.h"
#include "nvs_flash.h"
//操作系统相关头文件
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/ringbuf.h"

//UART CFG
#define USE_UART1_WITH_RS485
//UART0    DEBUG
#define UART_NUM        UART_NUM_0      // 使用 UART0
#define BUF_SIZE        (254)          // DMA 缓冲区大小
#define RD_BUF_SIZE     (BUF_SIZE / 2)  // 单次读取最大长度
#ifdef USE_UART1_WITH_RS485
//UART1    RS485
#define RS485_1DEPIN        13
#define RS485_1RXPIN        14
#define RS485_1TXPIN        12
#define RS4851_UARTNUM      UART_NUM_1
#endif
#ifdef USE_UART2_WITH_RS485
//UART2    RS485
#define RS485_2DEPIN        4
#define RS485_2RXPIN        16
#define RS485_2TXPIN        17
#define RS4852_UARTNUM      UART_NUM_2
#endif
//I2C CFG
#define I2C_MASTER_SCL_IO          22      // GPIO引脚号
#define I2C_MASTER_SDA_IO          21      // GPIO引脚号
#define I2C_MASTER_FREQ_HZ         100000  // I2C主时钟频率
#define I2C_MASTER_PORT_NUM        I2C_NUM_0

//GPIO CFG
#define ROTATE_HOM_TRIGGER         5
#define LIFT_HOM_TRIGGER           17
#define PROBE_TRIGGER_PIN          19
#define ROTATE_SENSOR_PIN          16